﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Storage;
using Storage.EntityModels;
using Stats;
using Stats.Objects;

namespace StatsUnitTests
{
    /// <summary>
    /// This class contains the tests for the stats module.
    /// </summary>
    [TestFixture]
    public class Tests
    {
        ///// <summary>
        ///// Tests the update UserFeedback statistics as driver operation.
        ///// </summary>
        //[Test]
        //public void TestUpdateUserFeedbackAsDriver()
        //{
        //    ReleasedFeedback req = new ReleasedFeedback(1, 5, 6, 7, 8);

        //    bool result = StatsModule.updateDriverFeedback(req);

        //    System.Console.WriteLine("UPDATE USER DRIVER FEEDBACK RESULT: " + result);

        //    System.Console.ReadLine();
        //}

        ///// <summary>
        ///// Tests the update UserFeedback statistics as passenger operation.
        ///// </summary>
        //[Test]
        //public void TestUpdateUserFeedbackAsPassenger()
        //{
        //    UpdatePassengerFeedbackRequest req = new UpdatePassengerFeedbackRequest(1, 5, 6, 7);

        //    bool result = StatsModule.updatePassengerFeedback(req);

        //    System.Console.WriteLine("UPDATE USER PASSENGER FEEDBACK RESULT: " + result);
        //    System.Console.ReadLine();
        //}

        /// <summary>
        /// Tests the get user feedback as driver operation.
        /// </summary>
        /*[Test]
        public void TestGetUserFeedbackAsDriver()
        {
            AsDriverFeedback fdb = StatsModule.getAsDriverFeedback(1);

            System.Console.WriteLine("USER AS DRIVER FEEDBACK:");
            System.Console.WriteLine();
            System.Console.WriteLine("AS DRIVER --> GENERAL VOTE = " + fdb.Vote);
            System.Console.WriteLine("AS DRIVER --> PUNCTUALITY VOTE = " + fdb.Punctuality);
            System.Console.WriteLine("AS DRIVER --> RELIABILITY VOTE = " + fdb.Reliability);
            System.Console.WriteLine("AS DRIVER --> KINDNESS VOTE = " + fdb.Courtesy);

            System.Console.ReadLine();
        }

        /// <summary>
        /// Tests the get user feedback as passenger operation.
        /// </summary>
        [Test]
        public void TestGetUserFeedbackAsPassenger()
        {
            AsPassengerFeedback fdb = StatsModule.getAsPassengerFeedback(1);

            System.Console.WriteLine("USER AS PASSENGER FEEDBACK:");
            System.Console.WriteLine();
            System.Console.WriteLine("AS PASSENGER --> GENERAL VOTE = " + fdb.Vote);
            System.Console.WriteLine("AS PASSENGER --> PUNCTUALITY VOTE = " + fdb.Punctuality);
            System.Console.WriteLine("AS PASSENGER --> RELIABILITY VOTE = " + fdb.Reliability);

            System.Console.ReadLine();
        }

        /// <summary>
        /// Tests the get user general feedback operation.
        /// </summary>
        [Test]
        public void TestGetUserGeneralFeedback()
        {
            GeneralFeedback fdb = StatsModule.getGeneralFeedback(1);

            System.Console.WriteLine("USER GENERAL FEEDBACK:");
            System.Console.WriteLine();
            System.Console.WriteLine("GENERAL VOTE: " + fdb.Vote);
            System.Console.WriteLine("GENERAL PUNCTUALITY VOTE: " + fdb.Punctuality);
            System.Console.WriteLine("GENERAL RELIABILITY VOTE: " + fdb.Reliability);

            System.Console.ReadLine();
        }

        /// <summary>
        /// Tests the insertion of a new entry in Daily Stats Table
        /// </summary>
        [Test]
        public void TestInsertEntryInDailyStatsTable()
        {
            DailyStatistics st = new DailyStatistics();

            st.Date = DateTime.Today;
            st.DailyCompletedTrips = 10;
            st.FuelSaved = 20f;
            st.MaximumPassengers = 4;
           // st.MissedAppointments = 2;  By Pier
            st.MoneySaved = 25;
            st.PassengerCarriedAlongTheWay = 3;
            st.PollutionSaved = 3.45f;
            st.TotalDailyTripProposal = 12;
            st.TotalKilometers = 300;
            st.TotalPassengers = 34;

            TripLoaDataContext db = Storage.StorageManager.Instance.Entities;

            db.DailyStatistics.InsertOnSubmit(st);
            db.SubmitChanges();

        }
*/
        /// <summary>
        /// Tests the get daily stats operation.
        /// </summary>
        //[Test]
        //public void TestGetGeneralStats()
        //{
        //    GeneralStats gen = StatsModule.getGeneralStats();

        //    int nDays = gen.NumberDaysStatsReferred;

        //    System.Console.WriteLine("GENERAL STATS REPORT ABOUT LAST " + nDays + " DAYS");
        //    System.Console.WriteLine();

        //    System.Console.WriteLine("TOTAL KM DONE: " + gen.TotalKm);
        //    System.Console.WriteLine("AVG KM DONE PER DAY: " + (double)gen.TotalKm / nDays);
        //    System.Console.WriteLine("TOTAL FUEL SAVED: " + gen.TotalFuelSaved + " LITERS");
        //    System.Console.WriteLine("AVG FUEL PER DAY: " + (double)gen.TotalFuelSaved / nDays + " LITERS");
        //    System.Console.WriteLine("TOTAL MONEY SAVED: " + gen.TotalMoneySaved + " EURO");
        //    System.Console.WriteLine("AVG MONEY PER DAY: " + (double)gen.TotalMoneySaved / nDays + " EURO");
        //    System.Console.WriteLine("TOTAL POLLUTION SAVED: " + gen.TotalPollutionSaved);
        //    System.Console.WriteLine("AVG POLLUTION PER DAY: " + (double)gen.TotalPollutionSaved / nDays);
        //    System.Console.WriteLine();
        //    System.Console.WriteLine("TOTAL PASSENGERS CARRIED: " + gen.TotalPassengersCarried);
        //    System.Console.WriteLine("AVG PASSENGERS CARRIED PER DAY: " + (double)gen.TotalPassengersCarried / nDays);
        //    System.Console.WriteLine("TOTAL PASSENGERS CARRIED ON THE WAY: " + gen.PassengersCarriedOnWayNumber);
        //    System.Console.WriteLine("AVG PASSENGERS CARRIED ON THE WAY PER DAY: " + (double)gen.PassengersCarriedOnWayNumber / nDays);
        //    System.Console.WriteLine("TOTAL PROPOSED TRIPS: " + gen.ProposedTripsNumber);
        //    System.Console.WriteLine("AVG PROPOSED TRIPS PER DAY: " + (double)gen.ProposedTripsNumber / nDays);
        //    System.Console.WriteLine("TOTAL HANDSHAKED TRIPS: " + gen.HandshakedTripsNumber);
        //    System.Console.WriteLine("AVG HANDSHAKED TRIPS PER DAY: " + (double)gen.HandshakedTripsNumber / nDays);
        //    System.Console.WriteLine("TOTAL MISSED TRIPS: " + gen.MissedTripsNumber);
        //    System.Console.WriteLine("AVG MISSED TRIPS PER DAY: " + (double)gen.MissedTripsNumber / nDays);

        //    System.Console.ReadLine();
        //}

        } 

    

}

    



